package com.dgut.model;

import com.dgut.Service.DataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class MyCommandLineRunner implements CommandLineRunner {
    private DataService service;

    @Autowired
    public void setService(DataService service) {
        this.service = service;
    }

    @Override
    public void run(String... args) throws Exception {
        //开启应用时爬取数据
        service.getRegionData();

        System.out.println("commandLineRunner爬取数据成功");
    }
}
